<script>
export default {
	globalData: {
		safeArea: 0
	},

	onLaunch: function () {
		let _this = this;
		uni.getSystemInfo({
			success(res) {
				_this.globalData.safeArea = res.safeAreaInsets.bottom;
				let token = uni.getStorageSync('access_token');
				let times = uni.getStorageSync('times');
				// 登录过期检测
				if (token) {
					if (times < _this.dayjs().unix()) {
						uni.clearStorageSync();
					}
				}
			}
		});
		// 新版本检测
		if (uni.canIUse('getUpdateManager')) {
			const updateManager = uni.getUpdateManager();
			updateManager.onCheckForUpdate(function (res) {
				if (res.hasUpdate) {
					updateManager.onUpdateReady(function (res) {
						uni.showModal({
							title: '更新提示',
							content: '新版本已经准备好，是否重启应用？',
							success(res) {
								if (res.confirm) {
									updateManager.applyUpdate();
								}
							}
						});
					});
				}
				updateManager.onUpdateFailed(function (res) {
					uni.showModal({
						title: '检测到新版本',
						content: '新版本已发布，请您删除当前小程序，重新搜索打开。'
					});
				});
			});
		} else {
			uni.showModal({
				title: '提示',
				content: '当前微信版本过低，无法使用该功能，请升级到最新微信版本后重试。'
			});
		}
	}
};
</script>

<style lang="scss">
@import '@/static/icons/iconfont.css';
/*每个页面公共css */
page {
	background: $uni-bg-color;
}
button {
	font-size: 32rpx;
}
button[type='primary'] {
	background: $uni-primary !important;
}
button[disabled][type='primary'] {
	background: $uni-info !important;
}
.uni-pagination {
	padding: 50rpx 50rpx 100rpx;
}

.header {
	position: sticky;
	top: 0;
	height: 94rpx;
	background: #fff;
	z-index: 90;
	.total {
		position: absolute;
		width: 25%;
		height: 92rpx;
		right: 0;
		top: 0;
		z-index: 100;
		background: #fff;
		text-align: center;
		line-height: 92rpx;
		font-size: 28rpx;
	}
}
.empty {
	display: flex;
	justify-content: center;
	align-items: center;
	flex-direction: column;
	padding: 50rpx 0;
	.image {
		display: block;
		width: 480rpx;
		height: 360rpx;
	}
	.emptyWord {
		font-size: 28rpx;
		color: $uni-secondary-color;
		text-align: center;
	}
}
.addBtn {
	position: fixed;
	z-index: 11;
	right: 15px;
	bottom: 30px;
	width: 110rpx;
	height: 110rpx;
	display: flex;
	justify-content: center;
	align-items: center;
	background: $uni-primary;
	border-radius: 100%;
	border-width: 0;
	box-shadow: 0 1px 8px 1px rgba(165, 165, 165, 0.2);
}

.formBox {
	.box {
		margin-bottom: 20rpx;
		background: #fff;
		padding: 0 20rpx;
		.uni-forms-item {
			border-bottom: 1px solid #f0f0f0;
			margin: 0;
			padding: 20rpx 0;
			&:last-child {
				border-bottom: none;
			}
			.is-input-border {
				border: none;
				border-radius: 0;
			}
			.uni-forms-item__label {
				padding: 0 !important;
				height: 70rpx;
				line-height: 70rpx;
			}
			.uni-forms-item__content {
				display: flex;
				flex-direction: row-reverse;
				.uni-easyinput__content-input {
					text-align: right;
					padding: 0 20rpx;
				}
				.uni-easyinput__content-textarea {
					padding: 10rpx;
				}
			}
			.uni-forms-item__error {
				padding: 0;
				top: 60rpx;
				left: unset;
				right: 20rpx;
			}
			.is-input {
				height: 70rpx;
				text-align: right;
				line-height: 70rpx;
				padding: 0 20rpx;
				width: 500rpx;
				color: $uni-main-color;
			}
			.dis-input {
				height: 70rpx;
				text-align: right;
				line-height: 70rpx;
				padding: 0 20rpx;
				width: 500rpx;
				color: $uni-secondary-color;
			}
			.picker-input {
				height: 70rpx;
				text-align: right;
				line-height: 70rpx;
				padding: 0 20rpx;
				width: 500rpx;
			}
			.room-input {
				height: 70rpx;
				padding: 0 20rpx;
				width: 500rpx;
				display: flex;
				justify-content: space-between;
				align-items: center;
				input {
					flex: 1;
					margin-right: 20rpx;
					height: 60rpx;
					padding: 0 20rpx;
					border-radius: 10rpx;
					border: 1rpx solid $uni-border-3;
					font-size: 28rpx;
					color: $uni-main-color;
				}
				.delete {
					width: 70rpx;
					height: 70rpx;
					display: flex;
					justify-content: center;
					align-items: center;
				}
			}
			.room-door {
				width: 500rpx;
				display: flex;
				flex-wrap: wrap;
				flex-direction: row;
				.door {
					width: 60rpx;
					height: 32rpx;
					line-height: 32rpx;
					padding: 0 10rpx;
					border-radius: 2rpx;
					color: rgba(0, 0, 0, 0.25);
					background: #f5f5f5;
					border: 1rpx solid #d9d9d9;
					white-space: nowrap;
					margin: 0 10rpx 10rpx 0;
					text-align: center;
				}
			}
		}
		.uni-data-checklist {
			padding-top: 20rpx;
			.checklist-group .checklist-box.is--tag {
				flex: 1;
				.checklist-content {
					justify-content: center;
				}
			}
		}
		.formTitle {
			font-size: 30rpx;
			font-weight: bold;
			color: #333;
			padding-top: 30rpx;
		}
	}
	.btns {
		padding: 100rpx 20rpx;
		display: flex;
		justify-content: space-between;
		.btn {
			margin: 0 10rpx;
			flex: 1;
		}
	}
}
.uni-numbox {
	.uni-numbox-btns {
		width: 24rpx;
		text-align: center;
	}
}
.hoverClass {
	background-color: #f1f1f1 !important;
}
</style>
